<?php

/**
 * Emms related date functions
 *
 * @author Andrés B
 * @todo Implement hollidays calendar
 */
class Emms_Date 
{   
    /**
     * Returns true if $date is hollidays, false otherwise.
     * Throws an exception if $date is malformed or invalid.
     * 
     * @param type $date Format YYYY-MM-DD
     * @return boolean
     * @throws Exception
     * @todo So far it only checks for weekends, needs to implement a true hollidays calendar
     */
    static function isHollidays($date)
    {
        if(!Zend_Date::isDate($date, 'YYYY-MM-DD')) 
            throw new Exception(Zend_Registry::get('Zend_Translate')->_("Invalid date or format"));
        $d = new Zend_Date($date, 'YYYY-MM-DD');
        if(($d->get('w') == 0)||($d->get('w') == 6)) return true;
        return false;
    }
}